home *** CD-ROM | disk | FTP | other *** search
/ Introduction to 3D Game …ogramming with DirectX 12 / Introduction-to-3D-Game-Programming-with-DirectX-12.ISO / Code.Textures / Chapter 22 Quaternions / QuatDemo / AnimationHelper.h < prev    next >
Encoding:
C/C++ Source or Header  |  2016-03-02  |  1.1 KB  |  44 lines

  1. //***************************************************************************************
  2. // AnimationHelper.h by Frank Luna (C) 2011 All Rights Reserved.
  3. //
  4. // Contains classes for defining keyframes and animation.
  5. //***************************************************************************************
  6.  
  7. #ifndef ANIMATION_HELPER_H
  8. #define ANIMATION_HELPER_H
  9.  
  10. #include "../../Common/d3dUtil.h"
  11.  
  12. ///<summary>
  13. /// A Keyframe defines the bone transformation at an instant in time.
  14. ///</summary>
  15. struct Keyframe
  16. {
  17.     Keyframe();
  18.     ~Keyframe();
  19.  
  20.     float TimePos;
  21.     DirectX::XMFLOAT3 Translation;
  22.     DirectX::XMFLOAT3 Scale;
  23.     DirectX::XMFLOAT4 RotationQuat;
  24. };
  25.  
  26. ///<summary>
  27. /// A BoneAnimation is defined by a list of keyframes.  For time
  28. /// values inbetween two keyframes, we interpolate between the
  29. /// two nearest keyframes that bound the time.  
  30. ///
  31. /// We assume an animation always has two keyframes.
  32. ///</summary>
  33. struct BoneAnimation
  34. {
  35.     float GetStartTime()const;
  36.     float GetEndTime()const;
  37.  
  38.     void Interpolate(float t, DirectX::XMFLOAT4X4& M)const;
  39.  
  40.     std::vector<Keyframe> Keyframes;     
  41.  
  42. };
  43.  
  44. #endif // ANIMATION_HELPER_H